From: David Härdeman Date: Tue, 7 Oct 2025 12:16:11 +0000 (+0200) Subject: dhcpv4: generate dbus events on lease expiry X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=c69200195263d6c253de68551da0e0f4887219c6;p=project%2Fodhcpd.git dhcpv4: generate dbus events on lease expiry We already generate events when a lease is acquired and released, so it seems consistent to also generate events when a lease expires. Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/270 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 45a6469..bdcd8e8 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -1192,8 +1192,12 @@ static void dhcpv4_valid_until_cb(struct uloop_timeout *event) continue; list_for_each_entry_safe(a, n, &iface->dhcpv4_assignments, head) { - if (!INFINITE_VALID(a->valid_until) && a->valid_until < now) + if (!INFINITE_VALID(a->valid_until) && a->valid_until < now) { + ubus_bcast_dhcp_event("dhcp.expire", a->hwaddr, + (struct in_addr *)&a->addr, + a->hostname, iface->ifname); free_assignment(a); + } } } uloop_timeout_set(event, 1000);